<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<body>
<h2>登录</h2>
<form id="loginForm">
    <label for="name">用户名:</label>
    <input type="text" id="name" name="name" required>
    <br>
    <label for="password">密码:</label>
    <input type="password" id="password" name="password" required>
    <br>
    <button type="submit">登录</button>
</form>

<p id="loginMessage"></p>

<script>
    document.getElementById('loginForm').addEventListener('submit', function(event) {
        event.preventDefault();

        var name = document.getElementById('name').value;
        var password = document.getElementById('password').value;

        var params = new URLSearchParams();
        params.append('name', name);
        params.append('password', password);

        fetch('/member/login?' + params.toString(), {
            method: 'POST'
        })
            .then(response => response.text())
            .then(data => {
                document.getElementById('loginMessage').innerText = data;
            });
    });
</script>
</body>
</html>
